import React from 'react';
import { Button, message } from 'antd';
import { Drawer } from '@ecoding/components.antd';

const Child = () => {
    const close = () => {
        Drawer.update({
            okButtonProps: {
                disabled: true
            }
        });
    }
    return <Button onClick={close}>改变属性</Button>
}

const C = () => {
    const handler = () => {
        Drawer.show({
            width: "70vw",
            component: <Child />,
            title: '抽屉标题',
            onOk: async () => {
                return new Promise(async (resolve, reject) => {
                    try {
                        resolve(true);
                    } catch (e: any) {
                        reject(e);
                    }
                });
            },
            onOkAfter: () => {
                message.success('操作成功');
            }
        });
    }
    return (
        <Button onClick={handler}>点击推出</Button>
    );
}

export default C;